bitkeeper revision 1.1159.170.94 (41e7844cyG1BmL1dUF848HyZ7mu87A)
authorkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>
Fri, 14 Jan 2005 08:35:24 +0000 (08:35 +0000)
committerkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>
Fri, 14 Jan 2005 08:35:24 +0000 (08:35 +0000)
Tweaks from Dan Magenheimer.

xen/common/string.c
xen/include/public/xen.h
xen/include/xen/irq.h
xen/include/xen/list.h

index c49d32deb0545896e70970b47ac13a5d87bc02ce..1f51b65ecb5432fdd1a22a9c31bf73421de6b741 100644 (file)
@@ -92,6 +92,32 @@ char * strncpy(char * dest,const char *src,size_t count)
 }
 #endif
 
+#ifndef __HAVE_ARCH_STRLCPY
+/**
+ * strlcpy - Copy a %NUL terminated string into a sized buffer
+ * @dest: Where to copy the string to
+ * @src: Where to copy the string from
+ * @size: size of destination buffer
+ *
+ * Compatible with *BSD: the result is always a valid
+ * NUL-terminated string that fits in the buffer (unless,
+ * of course, the buffer size is zero). It does not pad
+ * out the result like strncpy() does.
+ */
+size_t strlcpy(char *dest, const char *src, size_t size)
+{
+       size_t ret = strlen(src);
+
+       if (size) {
+               size_t len = (ret >= size) ? size-1 : ret;
+               memcpy(dest, src, len);
+               dest[len] = '\0';
+       }
+       return ret;
+}
+EXPORT_SYMBOL(strlcpy);
+#endif
+
 #ifndef __HAVE_ARCH_STRCAT
 /**
  * strcat - Append one %NUL-terminated string to another
@@ -449,7 +475,6 @@ void * memmove(void * dest,const void *src,size_t count)
  * @ct: Another area of memory
  * @count: The size of the area.
  */
-/*
 int memcmp(const void * cs,const void * ct,size_t count)
 {
        const unsigned char *su1, *su2;
@@ -460,7 +485,6 @@ int memcmp(const void * cs,const void * ct,size_t count)
                        break;
        return res;
 }
-*/
 #endif
 
 #ifndef __HAVE_ARCH_MEMSCAN
index 3f00fe2e0620c31ba7fe99897f6a1d9cce360998..9817b1a9e882b6baf13fc47d3135b9e8d773d782 100644 (file)
@@ -18,6 +18,8 @@
 #include "arch-x86_32.h"
 #elif defined(__x86_64__)
 #include "arch-x86_64.h"
+#elif defined(__ia64__)
+#include "arch-ia64.h"
 #else
 #error "Unsupported architecture"
 #endif
index 793a848f6366dc15ca929d1daa344dbfc841ab64..42e6d266a48438d97ae6c95301e4af330ae2510a 100644 (file)
@@ -21,6 +21,7 @@ struct irqaction
 #define IRQ_PENDING    4       /* IRQ pending - replay on enable */
 #define IRQ_REPLAY     8       /* IRQ has been replayed but not acked yet */
 #define IRQ_GUEST       16      /* IRQ is handled by guest OS(es) */
+#define IRQ_PER_CPU     256     /* IRQ is per CPU */
 
 /*
  * Interrupt controller descriptor. This is all we need
index 618f291962424b55e2dc201dcb439c7ed8c0cbd9..cc38a310cdc640f6b8386575645f91b266fd1930 100644 (file)
@@ -162,3 +162,16 @@ static __inline__ void list_splice(struct list_head *list, struct list_head *hea
                pos = n, n = pos->next)
 
 #endif
+
+/**
+ * list_for_each_entry -       iterate over list of given type
+ * @pos:       the type * to use as a loop counter.
+ * @head:      the head for your list.
+ * @member:    the name of the list_struct within the struct.
+ */
+#define list_for_each_entry(pos, head, member)                         \
+       for (pos = list_entry((head)->next, typeof(*pos), member),      \
+                    prefetch(pos->member.next);                        \
+            &pos->member != (head);                                    \
+            pos = list_entry(pos->member.next, typeof(*pos), member),  \
+                    prefetch(pos->member.next))